package com.backstage.productModule.controller;

import org.springframework.web.multipart.MultipartFile;

import java.util.UUID;

public class BaseController {
    //为文件创建新的名字
    public String newFileName(MultipartFile file){
        String[] split = file.getOriginalFilename().split("\\.");
        String ext = split[split.length - 1];
        return UUID.randomUUID().toString().replace("-","")+"."+ext;
    }
}
